<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="UILGestion._default" %>

<%@ Register Assembly="SesarchResultLib" Namespace="SesarchResultLib" TagPrefix="cc1" %>


<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Assembly="ExtAspNet" Namespace="ExtAspNet" TagPrefix="ext" %>


<%@ Register src="Control/ComparativoResuGrid.ascx" tagname="ComparativoResuGrid" tagprefix="uc1" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Sistema Gestion EOM</title>
    
    <meta name="Title" content="SISTEMA GESTION EOM" />
    <meta name="Description" content="Sistema EOM" />
    <meta name="Keywords" content="NETLOG" />
    <script src="Scripts/sessvars.js" type="text/javascript"></script>
    
    <link href="css/default.css" rel="stylesheet" type="text/css" />
    <link href="css/main.css" rel="stylesheet" type="text/css" />

    <link rel="stylesheet" type="text/css" href="../estilos/_common/styles/fonts.css" />
     <script src="Scripts/SearchResult.js" type="text/javascript"></script>

</head>
<body>
    <form id="form1" runat="server">
  

 
  <asp:ScriptManager  ID="ScriptManager1" runat="server"  EnablePageMethods="true" EnableScriptGlobalization="true"></asp:ScriptManager>
    <ext:PageManager ID="PageManager1" AutoSizePanelID="RegionPanel1" HideScrollbar="true" 
        runat="server"></ext:PageManager>
    <ext:RegionPanel ID="RegionPanel1" ShowBorder="false" runat="server">
        <Regions>
            <ext:Region ID="Region1" Margins="0 0 0 0" Height="40px" ShowBorder="false" ShowHeader="false"
                Position="Top" Layout="Fit" runat="server">
                
                <Items>
                    <ext:ContentPanel ShowBorder="false" ShowHeader="false" BodyStyle="margin-top: 0px;background-image: url(Images/login/base.png);background-repeat: repeat-x;"
                        ID="ContentPanel1" runat="server">

                             <table width="100%" border="0" align="center" style="color:#EBEBEB" cellpadding="0" cellspacing="0">
         <tr>
         <td><img src="Images/login/logo.png" />
         </td>
           <td  align="center" >TIPO DE CAMBIO DEL DOLLAR para HOY: <asp:Label ID="labCurrentVersion" ForeColor="#EBEBEB" runat="server"></asp:Label></td>
           <td  align="right">BUSCAR:</td>
           <td width="300" align="left" >
           
           <cc1:Input ID="SelectSearchTextBox" runat="server"    BorderStyle="None" 
            CssClass="busca"
                     DataType="List" method="GetSearchResult"  numColum="1"
                     OnSelect="SelectSearchResult" 
                     Width="160px" Font-Size="Small" />  
                </td>
                <td style="text-align:right;color:#ccc;"  width="300px">
                           
                            
                           <b>
                            <asp:Label ID="usuarioLabel" runat="server" ForeColor="#EBEBEB"  > </asp:Label>
                            <br />
                            <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="loginForm.aspx" ForeColor="SkyBlue"  Text="Cerrar Session" >
                            </asp:HyperLink>
                        
                        </td>

         </tr>
       </table>
  
                        
                        
                        
                        
                        
                        
                        
                      
                      
                    </ext:ContentPanel></Items></ext:Region><ext:Region ID="Region2" Split="true" Width="250px" Margins="0 0 0 0" ShowHeader="true"
                Title="" EnableCollapse="true" Layout="Fit" Position="Left" runat="server">

                <Items>
                   
               
                <ext:Accordion Width="250px" Height="450px" runat="server" ShowBorder="false" ShowHeader="false"
                        ShowCollapseTool="true">
                        <Panes>
                            <ext:AccordionPane runat="server" Title="Compras"   ID="logisticaLP" Expanded="false"
                                BodyPadding="2px 5px" Layout="Fit" ShowBorder="false"> <%--IconUrl="~/images/16/1.png"--%>
                                <Items>
                                    <ext:Tree runat="server" 
                                    EnableArrows="true" 
                                    ShowBorder="false" 
                                    ShowHeader="false"  
                                    CssClass="inline"
                                    AutoScroll="true" 
                                    ID="treeMenu">
                    </ext:Tree>
                                </Items>
                            </ext:AccordionPane>
                                   <ext:AccordionPane ID="ventaAP" runat="server" Title="Venta"  Expanded="false"
                                BodyPadding="2px 5px" Layout="Fit" ShowBorder="false"> <%--IconUrl="~/images/16/1.png"--%>
                                <Items>
                                    <ext:Tree runat="server" EnableArrows="true" ShowBorder="false" ShowHeader="false"  CssClass="inline"
                                       AutoScroll="true" ID="treeVenta">
                    </ext:Tree>
                                </Items>
                            </ext:AccordionPane>

                             <ext:AccordionPane ID="almacenAP" 
                                 runat="server" 
                                 Title="Almacen"
                                 Expanded="false"
                                 BodyPadding="2px 5px" 
                                 Layout="Fit" 
                                 ShowBorder="false"> 
                                <Items>
                                    <ext:Tree runat="server" 
                                       EnableArrows="true" 
                                       ShowBorder="false"
                                       ShowHeader="false" 
                                       CssClass="inline"
                                       AutoScroll="true" 
                                       ID="treeAlmacen">
                    </ext:Tree>
                                </Items>
                            </ext:AccordionPane>

                            <ext:AccordionPane runat="server" Title="Otros"  Expanded="false"
                                BodyPadding="2px 5px" ShowBorder="false" Layout="Fit" >
                                <Items>
                                    
                                    <ext:Tree runat="server" 
                                    EnableArrows="true" 
                                    ShowBorder="false" 
                                    ShowHeader="false" 
                                    AutoScroll="true" 
                                    ID="treeOption">
                                            </ext:Tree>
                                </Items>
                            </ext:AccordionPane>
                        </Panes>
                    </ext:Accordion>
                     </Items>


            </ext:Region>

            <ext:Region ID="mainRegion"  ShowHeader="false" Layout="Fit" Margins="0 0 0 0" Position="Center"
                runat="server">
                <Items>
               
                    <ext:TabStrip ID="mainTabStrip" EnableTabCloseMenu="true" ShowBorder="false" runat="server">
                    
                    <Tabs>
                       <%--<ext:Tab ID="Tabp1" Title="Inicio" Layout="Fit" Icon="House" runat="server">
                       <Items>
                                    <ext:ContentPanel ID="ContentPanel2" ShowBorder="false" BodyPadding="10px" ShowHeader="false" AutoScroll="true"
                                        CssClass="inline"   runat="server"   >
                                     






                                    </ext:ContentPanel>
                                    
                                    
                                    
                                    </Items>
                                    
                                    </ext:Tab>--%>
                                    
                                    
                                    </Tabs>
                                    </ext:TabStrip>
                                    </Items></ext:Region></Regions>
                                    
                                    
        </ext:RegionPanel>
        <ext:Window ID="windowSourceCode" Title="Source Code" Popup="false" EnableIFrame="true"
        runat="server" IsModal="true" Width="900px" Height="550px" EnableClose="true"
        EnableMaximize="true">
    </ext:Window>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
     <asp:Timer ID="Timer1" runat="server" Interval="50000"  
        ontick="Timer1_Tick"></asp:Timer>
        <asp:Label ID="Label1" runat="server" Text=""></asp:Label></ContentTemplate><Triggers>
  <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>

    </asp:UpdatePanel>

   
    </form>
  <%--  <img src="Images/logo/grupoEOM.jpg" id="logo" />--%>

 <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/menu.xml"></asp:XmlDataSource>
  <script type="text/javascript">

     ///setInterval('MantenSesion()', <%= (int) (0.9 * (Session.Timeout * 1000)) %>);

    ///setInterval('MantenSesion()', <%= (int) (5000) %>);
   
    function MantenSesion() 
{     
    var CONTROLADOR = "./refresh_session.aspx";
    var head = document.getElementsByTagName('head').item(0);   
             
    script = document.createElement('script');            
    script.src = CONTROLADOR ;
    script.setAttribute('type', 'text/javascript');
    script.defer = true;
    head.appendChild(script);
   
   //alert(mensage);
    //if(variableFinal.Le
 
} 


      function onReady() {
          var treeMenu = Ext.getCmp('<%= treeMenu.ClientID %>');
          var treeMenuVenta = Ext.getCmp('<%= treeVenta.ClientID %>');
          var treeAlmacen = Ext.getCmp('<%= treeAlmacen.ClientID %>');
          var treeOption = Ext.getCmp('<%= treeOption.ClientID %>');

          var mainTabStrip = Ext.getCmp('<%= mainTabStrip.ClientID %>');

          // fijammos la primera ventaja
          mainTabStrip.addTab({
              'id': 'tab_0',
              'url': "./Main/Mainform.aspx",
              'title': 'inicio',
              'Layout':'Fit',
              'closable': false,
              'bodyStyle': 'padding:0px; ',
              'iconCls': 'Hose'
             

          });




          function addExampleTab(node) {
              var href = node.attributes.href;
            
              var windowSourceCode = Ext.getCmp('<%= windowSourceCode.ClientID %>');
              // Generate source code button
              var sourcecodeButton = new Ext.Button({
                  text: "Presupuesto",
                  type: "button",
                  cls: "x-btn-text-icon",
                  icon: '<%= IconHelper.GetIconUrl(Icon.PageWhiteCode) %>',
                  listeners: {
                      click: function(button, e) {
                          windowSourceCode.box_show('./PresupuestoAdminForm.aspx');
                          e.stopEvent();
                      }
                  }
              });


              // Add a dynamic tab (With toolbar).
              //var mainTabStrip = Ext.getCmp('<%= mainTabStrip.ClientID %>');
              var tabID = 'tab' + node.id.replace('__', '-');
              mainTabStrip.addTab({
                  'id': tabID,
                  'url': href,
                  'title': node.text,
                  'closable': true,
                  'bodyStyle': 'padding:0px; ',
                  'iconCls': 'icon_' + href.replace(/[^.]+\./, '')


    
                             
              });
          }
////                  ,
//                  'tbar': new Ext.Toolbar({
//                  items: ['->', refreshButton]
          // Click the tree node.
//              })
          treeMenu.on('click', function(node, event) {
              if (node.isLeaf()) {
                  var href = node.attributes.href;
                  // Modify the location of current url.
                  //necesario para que trabaje los controles en defaults
                  //window.location.href = '#' + href;

                  addExampleTab(node);

                  // Don't response to this tree node's default behavior. 
                  event.stopEvent();
              }
          });


           treeOption.on('click', function(node, event) {
              if (node.isLeaf()) {
                  var href = node.attributes.href;
                  // Modify the location of current url.
                  //necesario para que trabaje los controles en defaults
                  // error al cargar pesta;an otros , se deshabilita
                  //window.location.href = '#' + href;

                  addExampleTab(node);

                  // Don't response to this tree node's default behavior. 
                  event.stopEvent();
              }
          });


          treeMenuVenta.on('click', function (node, event) {
              if (node.isLeaf()) {
                  var href = node.attributes.href;
                  // Modify the location of current url.
                  //necesario para que trabaje los controles en defaults
                  //window.location.href = '#' + href;

                  addExampleTab(node);

                  // Don't response to this tree node's default behavior. 
                  event.stopEvent();
              }
          });
          treeAlmacen.on('click', function (node, event) {
              if (node.isLeaf()) {
                  var href = node.attributes.href;
                  // Modify the location of current url.
                  //necesario para que trabaje los controles en defaults
                  //window.location.href = '#' + href;

                  addExampleTab(node);

                  // Don't response to this tree node's default behavior. 
                  event.stopEvent();
              }
          });

          






          (function pageFirstLoad() {
              var currentHash = window.location.hash.substr(1);
              var level1Nodes = treeMenu.getRootNode().childNodes;
              for (var i = 0; i < level1Nodes.length; i++) {
                  var level2Nodes = level1Nodes[i].childNodes;
                  for (var j = 0; j < level2Nodes.length; j++) {
                      var currentNode = level2Nodes[j];
                      if (currentNode.attributes.href === currentHash) {
                          level1Nodes[i].expand();
                          // We must retrieve this node again, because currentNode doesn't has parentNode property.
                          var foundNode = treeMenu.getNodeById(currentNode.id);
                          foundNode.select();
                          addExampleTab(foundNode);
                          return;
                      }
                  }
              }
          })();

      }

    </script>


    </body>
</html
